package observerpattern.example1;

import java.util.Observable;
import java.util.Observer;

/**
 * 具体观察者实现类，微信用户
 *
 * @author hongchen
 *         Created 2017-03-05-12:52
 */
public class ConcreteWeixinUserObserver implements Observer {
    //观察者自身的一些信息
    private String userObserverInfo;

    @Override
    public void update(Observable o, Object arg) {
        //拉模型
        System.out.println(userObserverInfo + "收到了消息：" + arg);
        //推模型
        System.out.println(userObserverInfo + "拉取消：" + ((ConcreteGongzonghaoSubject) o).getContend());
    }

    public String getUserObserverInfo() {
        return userObserverInfo;
    }

    public void setUserObserverInfo(String userObserverInfo) {
        this.userObserverInfo = userObserverInfo;
    }
}
